/**
 * json配置举例，更多配置请看 IConfigSchema
 * @author luguoxiang
 * @date 2022/7/5
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
import { FormProps } from 'tdesign-vue-next';
import { IConfigSchema, LgBizTree, LgBizTreeProps } from '@/soar';
import api from './api';

const fieldList: IConfigSchema<any>[] = [
  {
    field: 'name',
    label: '名称',
    dataType: 'string',
    form: {
      rules: true, // true方式配置校验，必填
    },
  },
  {
    field: 'code',
    label: '编码',
    dataType: 'string',
    table: {
      sorter: true,
    },
    form: {
      disabled: ({ isUpdate }) => isUpdate,
      rules: true,
    },
  },
  {
    field: 'remark',
    label: '备注',
    dataType: 'string',
    form: {
      component: 't-textarea',
    },
  },
];

export default fieldList;

export const ruleSchema: IConfigSchema<any>[] = [
  {
    field: 'name',
    label: '名称',
    dataType: 'string',
    form: {
      rules: true,
    },
  },
  {
    field: 'defaulted',
    label: '缺省的',
    dataType: 'boolean',
    form: {
      disabled({ data }) {
        return data.resourceId === '0';
      },
    },
  },
];
